package com.weight.common.model;

import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
 * easyui 分页模板
 *
 * @param <T>
 */
@Data
@Slf4j
public class PageResult<T> {
	
	private long total;   //(总数)和
	private List<T> rows; //rows(数据集合)
	 
	public PageResult() {
		super();
	}

	public PageResult(long total, List<T> rows) {
		super();
		this.total = total;
		this.rows = rows;
	}
	
	public PageResult(List<T> pageList) {
		super();
		PageInfo<T> pageInfo = new PageInfo<T>(pageList);
		this.total = pageInfo.getTotal();
		this.rows = pageInfo.getList();
		log.info("PageResult={}",JSON.toJSONString(this));
	}
}
